<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/common/taglibs.jsp" %>
<%@ include file="/WEB-INF/common/front/head-login.jsp" %>
<html>
<head>
    <title>登录</title>
</head>
<body class="login-layout blur-login">
<div class="main-container">
    <div class="main-content">
        <div class="row">
            <div class="col-sm-10 col-sm-offset-1">
                <div class="login-container">
                    <div class="center">
                        <h1>
                            <%--<i class="ace-icon fa fa-leaf green"></i>--%>
                            <img style="margin-top: -2px;" src="${pageContext.request.contextPath}/images/Cat_39.934426229508px_1198156_easyicon.net.png">
                            <span class="white" id="id-text2">javaCat后台管理系统</span>
                        </h1>
                    </div>

                    <div class="space-6"></div>
                    <div class="position-relative">
                        <div id="login-box" class="login-box visible widget-box no-border">
                            <div class="widget-body">
                                <div class="widget-main">
                                    <h4 class="header blue lighter bigger">
                                        <i class="ace-icon fa fa-coffee green"></i>
                                        请输入登录信息
                                    </h4>

                                    <div class="space-6"></div>

                                    <form id="loginForm" action="${pageContext.request.contextPath}/login/go" method="post">
                                        <fieldset>
                                            <label class="block clearfix">
												<span class="block input-icon input-icon-right">
													<input name="j_username" id="j_username" value="admin" autocomplete="off" type="text" class="form-control" placeholder="用户名"/>
													<i class="ace-icon fa fa-user"></i>
												</span>
                                            </label>

                                            <label class="block clearfix">
												<span class="block input-icon input-icon-right">
													<input name="j_password" id="j_password" value="123456" autocomplete="off" type="password" class="form-control" placeholder="密码"/>
													<i class="ace-icon fa fa-lock"></i>
												</span>
                                            </label>

                                            <div class="space"></div>

                                            <div class="clearfix">
                                                <button type="button" onclick="login()" class="width-35 pull-right btn btn-sm btn-primary">
                                                    <i class="ace-icon fa fa-key"></i>
                                                    <span class="bigger-110">登录</span>
                                                </button>
                                            </div>

                                            <div class="space-4"></div>
                                        </fieldset>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function login(e) {
        $("#loginForm").ajaxSubmit({
            success: function (result) {
                if (result && result.success) {
                    location.href = "${contextPath}/back/home";
                } else {
                    layer.msg(result.msg);
                }
            }, error: function () {
                layer.msg("登陆失败!", "网络异常，请稍候再试！");
            }
        });
    }

    $("#loginForm").keydown(function (e) { //设定enter键默认提交查询
        e = e || window.event;
        if (e.keyCode == 13) {
            login();
        }
    });
</script>
</body>
</html>